﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Sector7.Framework.Core;
using Sector7.Medical.Consts;
using Sector7.Medical.Events;

namespace Sector7.Medical.Controls
{
    /// <summary>
    /// NavigationStrip.xaml 的交互逻辑
    /// </summary>
    public partial class NavigationStrip : UserControl
    {
        #region Accessor
        public event ClickNavigationItemEventHandler ClickNavigationItem = null;
        #endregion

        #region Public functions
        public void InitializeControl(List<NavigationConfiguration> navigationConfigList)
        {
            stpMain.Children.Clear();

            foreach (var navigationConfig in navigationConfigList)
            {
                var navigationStripItem = new NavigationStripItem();
                navigationStripItem.InitializeControl(navigationConfig);
                navigationStripItem.Height = C_ControlSize.NAVIGATION_HEADER_HEIGHT;
                navigationStripItem.ClickNavigationItem += new ClickNavigationItemEventHandler(Item_ClickNavigationItem);

                stpMain.Children.Add(navigationStripItem);
            }
        }

        void Item_ClickNavigationItem(object sender, ClickNavigationItemEventArgs e)
        {
            OnClickNavigationItem(sender, e);
        }
        #endregion

        #region Private functions
        private void OnClickNavigationItem(object sender, ClickNavigationItemEventArgs e)
        {
            if (ClickNavigationItem != null)
            {
                ClickNavigationItem(sender, e);
            }
        }
        #endregion

        #region Structure
        public NavigationStrip()
        {
            InitializeComponent();
        }
        #endregion

        #region Inner members
        #endregion
    }
}
